package test;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;

public class AddLogger {

	public static void getAllFileName(String path, ArrayList<String> fileName) {
		File file = new File(path);
		File[] files = file.listFiles();
		String[] names = file.list();
		if (names != null)
			fileName.addAll(Arrays.asList(names));
		for (File a : files) {
			if (a.isDirectory())// 递归，是目录再查
			{
				getAllFileName(a.getAbsolutePath(), fileName);
			}
		}
	}

	public static void main(String[] args) {
		ArrayList<String> listFileName = new ArrayList<String>();
		getAllFileName("D:\\javaPPT\\作业\\3java adv", listFileName);
		for (String name : listFileName) {
			System.out.println(name);
		}

	}

}
